package com.beten.util;

import android.app.Activity;
import android.util.DisplayMetrics;

public class DeviceHelper {

	
	public static double DpToPx(double dp ,Activity activity)
	{
		double px=0;
		DisplayMetrics dm = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
		px = dp * (dm.densityDpi / 160.0);
		return px;
	}
	public static double pxToDp(double px,Activity activity)
	{
		double dp=0;
		DisplayMetrics dm = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
		dp = dp * (160.0/dm.densityDpi );
		return dp;
	}
}
